<template>
  <div class="aui-wrapper aui-page__login1 ">
    <div class="aui-content__wrapper login-wrapper"
         v-if="isShow"
         ref="loginWrapper">
      <!-- <main class="aui-content login-content"
            :style="scale"> -->
      <div class="aui-content login-content">
        <div class="login-body"
             :style="{'width':loginPlanWid,'height':loginPlanHei}">
          <div class="login-pane">
            <div><img style="margin-left:0px"
                   src="~@/assets/img/logo-3c.png" /></div>
            <div class="login-title-en">Ruien Smart Park</div>
            <div class="login-title">瑞恩智慧园区综合管理平台</div>
            <!-- <div class="login-msg">请在下方登录你的账户</div> -->
            <div class="pic"><img style="width:148px;height:148px"
                   src="~@/assets/img/pic.png" /></div>
            <login-page v-if="activeName === 'login1'" />
            <registered v-else />
          </div>
        </div>
      </div>
      <!-- </main> -->
    </div>
    <not-support v-else />
  </div>
</template>

<script>
import loginPage from './login-page1'
import registered from './registered'
import notSupport from './not-support'
import Cookies from 'js-cookie'
import { getBrowserInfo } from '@/utils'
export default {
  data () {
    return {
      activeName: 'login1',
      scale: {
        transform: `scale(1)`
      },
      isShow: true,
      loginPlanWid: '',
      loginPlanHei: '100vh'
    }
  },
  created () {
    if (getBrowserInfo() === 'Microsoft Internet Explorer') {
      this.isShow = false
    }
  },
  mounted () {
    Cookies.remove('token')
    this.resizePage()
    window.onresize = this.resizePage
    window.addEventListener('resize', () => {
      this.loginPlanWid = '' + window.innerWidth * 0.36 + 'px'
    })
  },
  components: {
    loginPage,
    registered,
    notSupport
  },
  methods: {
    resizePage () {
      let self = this
      const ref = this.$refs.loginWrapper
      if (!ref) { return }
      let width = ref.offsetWidth
      let height = ref.offsetHeight

      let leftNum = (1920 - width) / 2 - 10
      const topNum = (1080 - height) / 2
      let scaleX = width * 0.0004208
      let scaleY = height * 0.000865925
      // if (num > 1) {
      //   num = 1
      // }
      self.scale = {
        transform: `scale(${scaleX},${scaleY})`,
        left: `${-(leftNum) - 10}px`,
        top: `${-(topNum)}px`
      }
    },
    onActive (val) {
      this.activeName = val
    }
  }
}
</script>
<style lang="scss">
body {
  background-color: transparent !important;
  .login-header {
    font-size: 20px;
    color: #00e1eb;
    .login-header-title {
      font-size: 40px;
      padding: 0;
      margin: 0;
    }
  }
  .aui-page__login1 {
    &::before,
    &::after {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      z-index: -1;
      content: "";
    }
    &::before {
      background-image: url(~@/assets/img/shadow.png),
        url(~@/assets/img/ruien-logo-bg.png);
      background-repeat: no-repeat;
      background-size: 100% 100%, 100% 100%;
    }
    // &::after {
    //   background-color: rgba(38, 50, 56, 0.4);
    // }
    .aui-content {
      display: flex;
      flex-flow: column wrap;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
      // padding: 50px 1120px 150px;
      text-align: center;
      &__wrapper {
        height: 100vh;
        background-color: transparent;
        overflow-x: hidden;
        overflow-y: auto;
      }
    }
    .login-header {
      padding: 20px;
      // color: #fff;
      .login-brand {
        margin: 0 0 15px;
        font-size: 40px;
        font-weight: 400;
        letter-spacing: 2px;
        text-transform: uppercase;
      }
      .login-intro {
        padding: 0;
        margin: 0;
        list-style: none;
        > li {
          font-size: 16px;
          line-height: 1.5;
          color: rgba(255, 255, 255, 0.6);
          & + li {
            margin-top: 5px;
          }
        }
      }
    }
    .login-body,
    .login-footer {
      // width: 501px;
      // height: 580px;
    }
    .login-body {
      position: relative;
      padding: 20px 30px;
      color: #333333;
      background-color: #fff;
      // background-color: rgba(6, 89, 137, 0.26) !important;
      // background-image: url(~@/assets/img/login_msg.png);
      // background-repeat: no-repeat;
      // background-size: cover;
      // border: 2px solid #065989;
      .angle {
        position: absolute;
        width: 40px;
        height: 40px;
        background-image: url(~@/assets/img/angle2.png);
        background-repeat: no-repeat;
        background-size: cover;
      }
      .angle-top {
        top: 0;
        left: 0;
      }
      .angle-right {
        top: 0;
        right: 0;
        transform: rotate(90deg);
      }
      .angle-bottom {
        bottom: 0;
        right: 0;
        transform: rotate(180deg);
      }
      .angle-left {
        bottom: 0;
        left: 0;
        transform: rotate(270deg);
      }
      .login-title-imgdiv {
        padding: 30px 10px 30px;
      }
      .el-input__inner {
        border: 1px solid #b4b4b4;
        border-radius: 5px;
        background-color: transparent !important;
        height: 50px;
        color: #333333;
      }
      .el-button--primary {
        color: #fff;
        // background-color: #20a3f5;
        // border-color: #20a3f5;
        font-size: 24px;
        border-radius: 5px;
      }
      .el-button--success {
        color: #fff;
        // background-color: #18305a;
        border-color: #20a3f5;
        font-size: 18px;
      }
      .login-title-img {
        width: 272px;
        height: 36px;
        background-size: cover;
        background-repeat: no-repeat;
      }
      .el-input__prefix .el-input__icon {
        font-size: 16px;
      }
      // .login-captcha {
      //   height: $--input-height;
      //   line-height: $--input-height -2px;
      //   > img {
      //     max-width: 100%;
      //     cursor: pointer;
      //   }
      // }
      .login-shortcut {
        margin-bottom: 20px;
        &__title {
          position: relative;
          margin: 0 0 15px;
          font-weight: 400;

          &::before {
            position: absolute;
            top: 50%;
            right: 0;
            left: 0;
            z-index: 1;
            content: "";
            height: 1px;
            margin-top: -0.5px;
            // background-color: $--border-color-base;
            overflow: hidden;
          }
          > span {
            position: relative;
            z-index: 2;
            padding: 0 20px;
            color: rgba(0, 0, 0, 0.3);
            background-color: #fff;
          }
        }
        &__list {
          padding: 0;
          margin: 0;
          list-style: none;
          font-size: 0;
          > li {
            display: inline-block;
            vertical-align: middle;
            margin: 0 10px;
            font-size: 28px;
          }
        }
      }
      .login-guide {
        color: rgba(0, 0, 0, 0.3);
      }
    }
    .login-footer {
      position: absolute;
      bottom: 0;
      padding: 20px;
      color: rgba(255, 255, 255, 0.6);
      p {
        margin: 10px 0;
      }
      a {
        padding: 0 5px;
        color: rgba(255, 255, 255, 0.6);
        &:focus,
        &:hover {
          color: #fff;
        }
      }
    }
    // 右侧垂直风格
    &--right-vertical {
      .aui-content {
        flex-flow: row nowrap;
        justify-content: flex-start;
        align-items: stretch;
        padding: 0;
      }
      .login-header {
        flex: 1;
        display: flex;
        flex-flow: column wrap;
        justify-content: center;
        padding: 30px 120px;
        text-align: left;
      }
      .login-body {
        position: relative;
        display: flex;
        flex-flow: column wrap;
        justify-content: center;
        padding: 120px 30px 150px;
        text-align: center;
        .login-guide {
          margin-top: 0;
        }
      }
      .login-footer {
        right: 0;
        // color: $--color-text-regular;
        a {
          // color: $--color-text-regular;
          &:focus,
          &:hover {
            // color: $--color-primary;
          }
        }
      }
    }
    background-image: url(~@/assets/img/shadow.png),
      url(~@/assets/img/ruien-logo-bg.png) !important;
    background-repeat: no-repeat;
    background-size: 100% 100%, 100% 100%;
    .hide-box {
      width: 100%;
      height: 100%;
    }
    .login-wrapper {
      overflow: hidden;
      .login-content {
        width: 100%;
        height: 100%;
        position: relative;
        .login-body {
          position: fixed;
          right: 0;
          bottom: 0;
          top: 0;
          background-image: url(~@/assets/img/login-right.png);
          background-repeat: no-repeat;
          background-size: 100% 100%;
          background-color: transparent;
          .login-pane {
            background-color: #fff;
            // width: 432px;
            text-align: left;
            // position: absolute;
            // right: 110px;
            // top: 72px;
            text-align: center;
            padding: 5%;
            .login-title-en {
              margin-top: 20px;
              font-size: 42px;
              font-weight: bold;
            }
            .login-title {
              margin-top: 6px;
              font-size: 34px;
              font-weight: bold;
            }
            .pic {
              margin-bottom: 20px;
              margin-top: 20px;
              text-align: center;
            }
            .login-msg {
              margin-top: 10px;
              margin-bottom: 47px;
              font-size: 20px;
              color: #787878;
            }
          }
        }
      }
    }
    &::before,
    &::after {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      z-index: -1;
      content: "";
    }
    &::before {
      // background-size: contain;
    }
    &::after {
      background-color: transparent;
    }
  }
}
</style>
